package cn.esale.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * SaleOrder entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "SALE_ORDER")

public class SaleOrder implements java.io.Serializable {

	// Fields

	private BigDecimal odrId;

	private BigDecimal odrCustomerId;

	private String odrCustomerName;

	private String odrDeliverAddr;

	private Timestamp odrOrderDate;

	private Timestamp odrDeliverDate;

	private String odrStatus;

	private Set<SaleOrderLine> saleOrderLines = new HashSet<SaleOrderLine>(0);

	// Constructors

	/** default constructor */
	public SaleOrder() {
	}

	/** minimal constructor */
	public SaleOrder(BigDecimal odrId, BigDecimal odrCustomerId, String odrCustomerName, String odrDeliverAddr,
			Timestamp odrDeliverDate, String odrStatus) {
		this.odrId = odrId;
		this.odrCustomerId = odrCustomerId;
		this.odrCustomerName = odrCustomerName;
		this.odrDeliverAddr = odrDeliverAddr;
		this.odrDeliverDate = odrDeliverDate;
		this.odrStatus = odrStatus;
	}

	/** full constructor */
	public SaleOrder(BigDecimal odrId, BigDecimal odrCustomerId, String odrCustomerName, String odrDeliverAddr,
			Timestamp odrOrderDate, Timestamp odrDeliverDate, String odrStatus, Set<SaleOrderLine> saleOrderLines) {
		this.odrId = odrId;
		this.odrCustomerId = odrCustomerId;
		this.odrCustomerName = odrCustomerName;
		this.odrDeliverAddr = odrDeliverAddr;
		this.odrOrderDate = odrOrderDate;
		this.odrDeliverDate = odrDeliverDate;
		this.odrStatus = odrStatus;
		this.saleOrderLines = saleOrderLines;
	}

	// Property accessors
	@Id
	@Column(name = "ODR_ID")
	@GenericGenerator(name="incrementName",strategy="increment")
	@GeneratedValue(generator="incrementName")
	public BigDecimal getOdrId() {
		return this.odrId;
	}

	public void setOdrId(BigDecimal odrId) {
		this.odrId = odrId;
	}

	@Column(name = "ODR_CUSTOMER_ID", nullable = false, scale = 0)
	public BigDecimal getOdrCustomerId() {
		return this.odrCustomerId;
	}

	public void setOdrCustomerId(BigDecimal odrCustomerId) {
		this.odrCustomerId = odrCustomerId;
	}

	@Column(name = "ODR_CUSTOMER_NAME", nullable = false, length = 100)
	public String getOdrCustomerName() {
		return this.odrCustomerName;
	}

	public void setOdrCustomerName(String odrCustomerName) {
		this.odrCustomerName = odrCustomerName;
	}

	@Column(name = "ODR_DELIVER_ADDR", nullable = false, length = 500)
	public String getOdrDeliverAddr() {
		return this.odrDeliverAddr;
	}

	public void setOdrDeliverAddr(String odrDeliverAddr) {
		this.odrDeliverAddr = odrDeliverAddr;
	}

	@Column(name = "ODR_ORDER_DATE", length = 7)
	public Timestamp getOdrOrderDate() {
		return this.odrOrderDate;
	}
	
	public void setOdrOrderDate(Timestamp odrOrderDate) {
		this.odrOrderDate = odrOrderDate;
	}

	@Column(name = "ODR_DELIVER_DATE", nullable = false, length = 7)
	public Timestamp getOdrDeliverDate() {
		return this.odrDeliverDate;
	}

	public void setOdrDeliverDate(Timestamp odrDeliverDate) {
		this.odrDeliverDate = odrDeliverDate;
	}

	@Column(name = "ODR_STATUS", nullable = false, length = 15)
	public String getOdrStatus() {
		return this.odrStatus;
	}

	public void setOdrStatus(String odrStatus) {
		this.odrStatus = odrStatus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "saleOrder")
	public Set<SaleOrderLine> getSaleOrderLines() {
		return this.saleOrderLines;
	}

	public void setSaleOrderLines(Set<SaleOrderLine> saleOrderLines) {
		this.saleOrderLines = saleOrderLines;
	}

}